package com.hmy.cornpestdet.vo;

import com.hmy.cornpestdet.pojo.MyPoint;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class PolygonAreaVo {
    private List<MyPoint> points;
    private int editable;
    private String fillColor;
    private String addDate;

    public String getPointsStr(){
        StringBuilder sb = new StringBuilder("POLYGON((");
        for (int i = 0; i < points.size(); i++) {
            MyPoint point = points.get(i);
            sb.append(point.getLng()).append(" ").append(point.getLat());
            if (i < points.size() - 1) {
                sb.append(", ");
            }
        }
        sb.append("))");
        return sb.toString();
    }

}
